package cn.fl.project.controller;

import cmm.comm.facade.framework.api.ISysDictionaryApiService;
import cmm.mid.core.framework.page.DataResultVO;
import cmm.mid.core.framework.page.KeyValueVO;
import cmm.mid.core.framework.page.ListPageVO;
import cmm.mid.core.framework.page.Pager;
import cmm.web.core.framework.controller.BaseController;
import cn.cmm.base.framework.constant.BaseConstant;
import cn.cmm.base.framework.exception.BaseException;
import cn.cmm.base.framework.logger.eum.LogExceptionEnum;
import cn.cmm.base.framework.utils.BaseLogUtils;
import cn.cmm.base.framework.utils.CollectionUtils;
import cn.cmm.base.framework.utils.StringUtils;
import cn.cmm.cache.framework.utils.PropertiesCacheUtils;
import cn.fl.customer.service.ICstBscInfoService;
import cn.fl.customer.service.ICstNpBscInfoService;
import cn.fl.customer.transform.CstBscInfoVOTransform;
import cn.fl.customer.transform.CstNpBscInfoVOTransform;
import cn.fl.customer.vo.CstBscInfoVO;
import cn.fl.customer.vo.CstNpBscInfoVO;
import cn.fl.framework.base.constant.WebBaseConstant;
import cn.fl.framework.base.context.CurrentThreadContext;
import cn.fl.framework.constant.DictionaryConstant;
import cn.fl.project.api.IPrjContApiService;
import cn.fl.project.condition.PrjCstBscInfoQueryCondition;
import cn.fl.project.constant.PrjBscInfoConstant;
import cn.fl.project.constant.PrjCstBscInfoConstant;
import cn.fl.project.service.IPrjBscInfoService;
import cn.fl.project.service.IPrjCstBscInfoService;
import cn.fl.project.vo.PrjBscInfoVO;
import cn.fl.project.vo.PrjCstBscInfoVO;
import cn.fl.riskctrl.service.IRskCtrlService;
import cn.fl.system.constant.SysLogConstant;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import fl.customer.facade.customer.api.ICustomerApiService;
import fl.customer.facade.customer.api.ICustomerQueryApiService;
import fl.customer.facade.customer.condition.CstBscInfoQueryCondition;
import fl.customer.facade.customer.condition.CstCorpTeamQueryCondition;
import fl.customer.facade.customer.condition.CstNpSocialRlQueryCondition;
import fl.customer.facade.customer.constant.CustomerConstant;
import fl.customer.facade.customer.dto.CstBscInfoDTO;
import fl.customer.facade.customer.dto.CstCorpTeamDTO;
import fl.customer.facade.customer.dto.CstNpBscInfoDTO;
import fl.customer.facade.customer.dto.CstNpSocialRlDTO;
import fl.riskctrl.facade.externalinterface.service.dto.TheWorstRcCstBscInfoResult;
import net.sf.json.JSONArray;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;

/**
 * @Description: 项目客户基础信息表 控制层
 */
@Controller
@RequestMapping("/project/prjcstbscInfo")
public class PrjCstBscInfoController extends BaseController {

	private static final Logger logger = LoggerFactory.getLogger(PrjCstBscInfoController.class);

	/**
	 * PrjCstBscInfo 服务层BEAN
	 */
	@Autowired
	private IPrjCstBscInfoService prjCstBscInfoService;
	@Autowired
	private ICstBscInfoService cstBscInfoService;
	
	/**
	 * 数据字典服务
	 */
	@Autowired
	private ISysDictionaryApiService sysDictionaryApiService;
	@Autowired
	private IPrjBscInfoService prjBscInfoService;

	@Autowired
	private IRskCtrlService rskCtrlService;

	@Autowired
	private ICustomerQueryApiService customerQueryApiService;

	@Autowired
	private ICustomerApiService customerApiService;

	@Autowired
	private IPrjContApiService prjContApiService;

	@Autowired
	private ICstNpBscInfoService cstNpBscInfoService; // 自然人信息
	
	/**
	 * 到列表页面
	 */
	@RequestMapping(value = "/toListPage.do", method = { RequestMethod.GET})
	public ModelAndView toListPage(HttpServletRequest request, HttpServletResponse response) {
		ModelAndView view = new ModelAndView("project/prjCstInfo/prjCstBscInfoList");
		List<KeyValueVO> cststscdlist = this.cstBscInfoService.searchCstStsCdList();
		String prjId = request.getParameter("prjId");
		String detailFlag = request.getParameter("detailFlag");
		String cstRlCd = request.getParameter("cstRlCd");//客户关系
		view.addObject("searchSelectCststscdlist", cststscdlist);
		// 客户类型
		List<KeyValueVO> csttypcdlist = this.cstBscInfoService.searchCstTypCdList();
		view.addObject("searchSelectCsttypcdlist", csttypcdlist);
		//查询项要有默认值,这里给出默认值到前端页面显示
		view.addObject("currentBuOrgCd", CurrentThreadContext.getCurrentBuOrgCd());
		view.addObject("currentCstRlType", DictionaryConstant.CODE_GRP_CST_RL_TYP_CD_1);
		view.addObject("prjId", prjId);
		view.addObject("detailFlag", detailFlag);
		view.addObject("cstRlCd", cstRlCd);
		BaseLogUtils.info(logger, "toListPage", "跳转到列表页面.", CurrentThreadContext.getCurrentUserName());
		return view;
	}

	/**
	 * 到修改页面
	 */
	@RequestMapping(value = "/modifyNpGuarPage.do", method = { RequestMethod.GET, RequestMethod.POST })
	public ModelAndView modifyNpGuarPage(HttpServletRequest request, HttpServletResponse response) {
		String id = request.getParameter("id");
		String mp1 = request.getParameter("mp1");
		String genderCdNm = request.getParameter("genderCdNm");
		String showGuarPart = request.getParameter("showGuarPart");
		String prjId = request.getParameter("prjId");
		String isPushCon = request.getParameter("isPushCon");
		String onlyConTyp = request.getParameter("onlyConTyp");
		PrjCstBscInfoVO cstBscInfoVO = this.prjCstBscInfoService.selectById(Long.valueOf(id));
		List<KeyValueVO>  rlCdList = this.prjBscInfoService.getRlCdList();
		List<KeyValueVO> guaraTypList = this.sysDictionaryApiService.getKvList(PrjCstBscInfoConstant.GUARA_TYP_CD, CurrentThreadContext.getCurrentSysCd(), CurrentThreadContext.getCurrentOrgCd());
		List<KeyValueVO> cntTypList = this.sysDictionaryApiService.getKvList(PrjCstBscInfoConstant.CODE_CNT_TYP_CD, CurrentThreadContext.getCurrentSysCd(), CurrentThreadContext.getCurrentOrgCd());
		Map<String,String> guaraTypMap = sysDictionaryApiService.searchGroupToMap(CurrentThreadContext.getCurrentSysCd(), CurrentThreadContext.getCurrentOrgCd(), PrjCstBscInfoConstant.GUARA_TYP_CD) ;//担保属性
		ModelAndView view = new ModelAndView("project/prjcstinvestrptinfo/npGuarModify");
		view.addObject("mp1", mp1);
		view.addObject("genderCdNm", genderCdNm);
		view.addObject("cst", cstBscInfoVO);
		view.addObject("rlCdList", rlCdList);
		view.addObject("guaraTypCd", cstBscInfoVO.getGuaraTypCd());
		view.addObject("guaraTypCdNm", guaraTypMap.get(cstBscInfoVO.getGuaraTypCd()));
		view.addObject("guaraTypList", guaraTypList);
		view.addObject("cntTypList", cntTypList);
		view.addObject("showGuarPart", showGuarPart);
		view.addObject("prjId", prjId);
		view.addObject("isPushCon", isPushCon);
		view.addObject("onlyConTyp", onlyConTyp);
		BaseLogUtils.info(logger, "toModifyPage", "跳转到修改页面.[id="+id+"]", CurrentThreadContext.getCurrentUserName());
		return view;
	}

	/**
	 * 到修改页面
	 */
	@RequestMapping(value = "/detailNpGuarPage.do", method = { RequestMethod.GET, RequestMethod.POST })
	public ModelAndView detailNpGuarPage(HttpServletRequest request, HttpServletResponse response) {
		String id = request.getParameter("id");
		String mp1 = request.getParameter("mp1");
		String genderCdNm = request.getParameter("genderCdNm");
		String showGuarPart = request.getParameter("showGuarPart");
		PrjCstBscInfoVO cstBscInfoVO = this.prjCstBscInfoService.selectById(Long.valueOf(id));
		List<KeyValueVO> rlCdList = this.prjBscInfoService.getRlCdList();
		Map<String,String> guaraTypMap = sysDictionaryApiService.searchGroupToMap(CurrentThreadContext.getCurrentSysCd(), CurrentThreadContext.getCurrentOrgCd(),PrjCstBscInfoConstant.GUARA_TYP_CD) ;//担保属性
		Map<String,String> cntTypMap = sysDictionaryApiService.searchGroupToMap(CurrentThreadContext.getCurrentSysCd(), CurrentThreadContext.getCurrentOrgCd(),PrjCstBscInfoConstant.CODE_CNT_TYP_CD) ;//签署方式
		BaseLogUtils.newLogger("detailNpGuarPage---guaraTypMap=" + JSON.toJSONString(guaraTypMap) + ",cntTypMap=" + cntTypMap).info();
		ModelAndView view = new ModelAndView("project/prjcstinvestrptinfo/npGuarDetail");
		view.addObject("mp1", mp1);
		view.addObject("genderCdNm", genderCdNm);
		view.addObject("cst", cstBscInfoVO);
		view.addObject("rlCdList", rlCdList);
		view.addObject("guaraTypCdNm", guaraTypMap.get(cstBscInfoVO.getGuaraTypCd()));
		view.addObject("cntTypCdNm", cntTypMap.get(cstBscInfoVO.getCntTypCd()));
		view.addObject("showGuarPart", showGuarPart);
		BaseLogUtils.info(logger, "toModifyPage", "跳转到修改页面.[id="+id+"]", CurrentThreadContext.getCurrentUserName());
		return view;
	}
	/**
	 * 到修改页面
	 */
	@RequestMapping(value = "/modifyCorpGuarPage.do", method = { RequestMethod.GET, RequestMethod.POST })
	public ModelAndView modifyCorpGuarPage(HttpServletRequest request, HttpServletResponse response) {
		String id = request.getParameter("id");
		String mnm = request.getParameter("mnm");
		String mp1 = request.getParameter("mp1");
		PrjCstBscInfoVO cstBscInfoVO = this.prjCstBscInfoService.selectById(Long.valueOf(id));
		List<KeyValueVO>  rlCdList = this.prjBscInfoService.getRlCdList();

		ModelAndView view = new ModelAndView("project/prjcstinvestrptinfo/corpGuarModify");
		view.addObject("cst", cstBscInfoVO);
		view.addObject("mnm", mnm);
		view.addObject("mp1", mp1);
		view.addObject("rlCdList",rlCdList);
		BaseLogUtils.info(logger, "toModifyPage", "跳转到修改页面.[id="+id+"]", CurrentThreadContext.getCurrentUserName());
		return view;
	}
	/**
	 * 到修改页面
	 */
	@RequestMapping(value = "/detailCorpGuarPage.do", method = { RequestMethod.GET, RequestMethod.POST })
	public ModelAndView detailCorpGuarPage(HttpServletRequest request, HttpServletResponse response) {
		String id = request.getParameter("id");
		String mnm = request.getParameter("mnm");
		String mp1 = request.getParameter("mp1");
		PrjCstBscInfoVO cstBscInfoVO = this.prjCstBscInfoService.selectById(Long.valueOf(id));
		List<KeyValueVO>  rlCdList = this.prjBscInfoService.getRlCdList();
		ModelAndView view = new ModelAndView("project/prjcstinvestrptinfo/corpGuarDetail");
		view.addObject("cst", cstBscInfoVO);
		view.addObject("mnm", mnm);
		view.addObject("mp1", mp1);
		view.addObject("rlCdList",rlCdList);
		BaseLogUtils.info(logger, "toModifyPage", "跳转到修改页面.[id="+id+"]", CurrentThreadContext.getCurrentUserName());
		return view;
	}
	/**
	 * 初始化列表
	 */
	@SuppressWarnings("unchecked")
	@RequestMapping(value = "/initList.do", method = { RequestMethod.GET})
	@ResponseBody
	public Object initList(HttpServletRequest request, HttpServletResponse response) {
		String currentPage = request.getParameter("page");
		String pageSize = request.getParameter("pagesize");
		String cstTypCd = request.getParameter("cstTypCd");//客户类型
		String cstRlTyp = request.getParameter("cstRlTyp");//客户属性
		String cstNm = request.getParameter("cstNm");//客户名称
		String prjId = request.getParameter("prjId");//项目Id
		Pager page = new Pager();
		if (StringUtils.isNotEmpty(currentPage)) {
			page.setCurrentPage(Integer.parseInt(currentPage));
		}

		if (StringUtils.isNotEmpty(pageSize)) {
			page.setEveryPage(Integer.parseInt(pageSize));
		}

		PrjCstBscInfoQueryCondition qc = new PrjCstBscInfoQueryCondition();
		if (StringUtils.isNotEmpty(cstNm)) {
			qc.setCstNm(cstNm);
		}
		if (StringUtils.isNotEmpty(cstTypCd)) {
			qc.setCstTypCd(cstTypCd);
		}
		if (StringUtils.isNotEmpty(cstRlTyp)) {
			qc.setCstRlTyp(cstRlTyp);
		}
		if(StringUtils.isNotBlank(prjId)){
			qc.setPrjId(Long.valueOf(prjId));
		}
		page.setCondition(qc);

		Pager pager = this.prjCstBscInfoService.searchListPage(page);
		List<PrjCstBscInfoVO> list = (List<PrjCstBscInfoVO>) pager.getResultList();
		ListPageVO<PrjCstBscInfoVO> listPage = new ListPageVO<PrjCstBscInfoVO>(list, pager.getTotalCount());
		BaseLogUtils.info(logger, "initList", "查询数据完成. DATA:" + JSONObject.toJSONString(page), CurrentThreadContext.getCurrentUserName());
		return listPage;
	}

	/**
	 * 根据客户经理查询承租人征信
	 */
	@SuppressWarnings("unchecked")
	@RequestMapping(value = "/searchRcCstBscInfoByCstMgr.do", method = { RequestMethod.POST})
	@ResponseBody
	public Object searchRcCstBscInfoByCstMgr(HttpServletRequest request, HttpServletResponse response) {
		Long startTm = System.currentTimeMillis();
		BaseLogUtils.info(logger,"searchRcCstBscInfoByCstMgr","根据客户经理查询承租人征信.请求时间：" + startTm + "-请求参数：" + this.getRequestParameter(request));
		String prjId = request.getParameter("prjId");//项目Id
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_NO, "征信查询失败");
		if(StringUtils.isBlank(prjId)){
			result.setInfo("项目ID为空");
			return result;
		}
		try {
			PrjBscInfoVO prjBscInfoVO = this.prjBscInfoService.selectById(Long.valueOf(prjId));
			BaseLogUtils.info(logger,"searchRcCstBscInfoByCstMgr","根据客户经理查询承租人征信.项目信息：" + JSON.toJSONString(prjBscInfoVO));
			if(prjBscInfoVO!=null){
				Long cstId = prjBscInfoVO.getCstId();
				Long cstMgrId = prjBscInfoVO.getCstMgrId();
				CstBscInfoDTO cstBscInfoDTO = this.customerQueryApiService.getCstBscInfoById(cstId);
				BaseLogUtils.info(logger,"searchRcCstBscInfoByCstMgr","根据客户经理查询承租人征信.客户信息：" + JSON.toJSONString(cstBscInfoDTO));
				String cstTypCd = cstBscInfoDTO.getCstTypCd();
				String certNo = "";
				String cstNm = "";
				String mp1 = "";
				if(StringUtils.isNotBlank(cstTypCd) && cstTypCd.equals(CustomerConstant.CST_TYP_CD_NP)){//自然人
					certNo = cstBscInfoDTO.getCertNo();
					cstNm = cstBscInfoDTO.getCstNm();
					CstNpBscInfoDTO cstNpBscInfo = this.customerQueryApiService.getCstNpBscInfoById(cstId);
					if(cstNpBscInfo == null || StringUtils.isEmpty(cstNpBscInfo.getMp1())){
						throw new BaseException("客户信息异常");
					}
					mp1 = cstNpBscInfo.getMp1();
				}else if(StringUtils.isNotBlank(cstTypCd) && cstTypCd.equals(CustomerConstant.CST_TYP_CD_CORP)){//法人  法人代表的证件号？
					CstCorpTeamQueryCondition condition = new CstCorpTeamQueryCondition();
					condition.setCstId(cstId);
					condition.setIsDel(BaseConstant.IS_YESNO_NO);
					condition.setmTypCd(CustomerConstant.CST_CORP_TEAM_LOWER);
					List<CstCorpTeamDTO> cstCorpTeamDTOList = this.customerApiService.searchCstCorpTeamList(condition);
					BaseLogUtils.info(logger,"searchRcCstBscInfoByCstMgr","根据客户经理查询承租人征信.法人团队信息：" + JSON.toJSONString(cstCorpTeamDTOList));
					if(CollectionUtils.isNotEmpty(cstCorpTeamDTOList)){
						for(CstCorpTeamDTO cstCorpTeamDTO : cstCorpTeamDTOList){
							if(StringUtils.isNotBlank(cstCorpTeamDTO.getCertNo())){
								certNo = cstCorpTeamDTO.getCertNo();
								cstNm = cstCorpTeamDTO.getMNm();
								mp1 = cstCorpTeamDTO.getMp1();
								break;
							}
						}
					}
				}
				cmm.mid.core.framework.dto.DataResultDTO dataResultDTO = this.rskCtrlService.searchRcCstBscInfoByCstMgr(certNo,cstNm,mp1,cstMgrId);
				BaseLogUtils.info(logger,"searchRcCstBscInfoByCstMgr","根据客户经理查询承租人征信.结果：" + JSON.toJSONString(dataResultDTO));
				if(dataResultDTO!=null && dataResultDTO.getSuccess() == BaseConstant.IS_YESNO_YES){
					TheWorstRcCstBscInfoResult rcCstCddunderlineBody = (TheWorstRcCstBscInfoResult)(dataResultDTO.getData());
					BaseLogUtils.info(logger,"searchRcCstBscInfoByCstMgr","根据客户经理查询承租人征信.DATA：" + JSON.toJSONString(rcCstCddunderlineBody));
					if(rcCstCddunderlineBody!=null){
						Long rcCstBscInfoId = rcCstCddunderlineBody.getRcCstBscInfoId();
						BaseLogUtils.info(logger,"searchRcCstBscInfoByCstMgr","根据客户经理查询承租人征信.rcCstBscInfoId：" + JSON.toJSONString(rcCstBscInfoId));
						result.setSuccess(BaseConstant.IS_YESNO_YES);
						result.setInfo("征信查询成功");
						result.setData(rcCstBscInfoId);
					}
				}
			}
		} catch (BaseException e1) {
			result.setInfo(e1.getMessage());
			BaseLogUtils.info(logger,"searchRcCstBscInfoByCstMgr","根据客户经理查询承租人征信.异常：" + e1.getMessage());
		} catch (Exception e2) {
			BaseLogUtils.info(logger,"searchRcCstBscInfoByCstMgr","根据客户经理查询承租人征信.异常");
		}
		Long endTm = System.currentTimeMillis();
		BaseLogUtils.info(logger,"searchRcCstBscInfoByCstMgr","根据客户经理查询承租人征信.耗时：" + (endTm - startTm) + "-返回结果：" + JSON.toJSONString(result));
		return result;
	}

	/**
	 * 初始化列表
	 */
	@SuppressWarnings("unchecked")
	@RequestMapping(value = "/guarInitList.do", method = { RequestMethod.GET})
	@ResponseBody
	public Object guarInitList(HttpServletRequest request, HttpServletResponse response) {
		String currentPage = request.getParameter("page");
		String pageSize = request.getParameter("pagesize");
		String cstTypCd = request.getParameter("cstTypCd");//客户类型
		String cstRlTyp = request.getParameter("cstRlTyp");//客户属性
		String cstNm = request.getParameter("cstNm");//客户名称
		String prjId = request.getParameter("prjId");//项目Id
		Pager page = new Pager();
		if (StringUtils.isNotEmpty(currentPage)) {
			page.setCurrentPage(Integer.parseInt(currentPage));
		}

		if (StringUtils.isNotEmpty(currentPage)) {
			page.setEveryPage(Integer.parseInt(pageSize));
		}

		PrjCstBscInfoQueryCondition qc = new PrjCstBscInfoQueryCondition();
		if (StringUtils.isNotEmpty(cstNm)) {
			qc.setCstNm(cstNm);
		}
		if (StringUtils.isNotEmpty(cstTypCd)) {
			qc.setCstTypCd(cstTypCd);
		}
		if (StringUtils.isNotEmpty(cstRlTyp)) {
			qc.setCstRlTyp(cstRlTyp);
		}
		if(StringUtils.isNotBlank(prjId)){
			qc.setPrjId(Long.valueOf(prjId));
		}
		qc.setSysCd(CurrentThreadContext.getCurrentSysCd());
		qc.setOrgCd(CurrentThreadContext.getCurrentOrgCd());
		page.setCondition(qc);

		Pager pager = this.prjCstBscInfoService.searchGuarListPage(page);
		List<PrjCstBscInfoVO> list = (List<PrjCstBscInfoVO>) pager.getResultList();
		ListPageVO<PrjCstBscInfoVO> listPage = new ListPageVO<PrjCstBscInfoVO>(list, pager.getTotalCount());
		BaseLogUtils.info(logger, "initList", "查询数据完成. DATA:" + JSONObject.toJSONString(page), CurrentThreadContext.getCurrentUserName());
		return listPage;
	}
	/**
	 * 删除数据
	 */
	@RequestMapping(value = "/removeByIds.do", method = {RequestMethod.POST })
	@ResponseBody
	public DataResultVO removeByIds(HttpServletRequest request, HttpServletResponse response) throws BaseException {
		String ids = request.getParameter("ids");
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_DELETE_SUCC);
		if(StringUtils.isEmpty(ids)){
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_DATA_PK_IS_EMPTY);
			return result;
		}
		List<Long> idList = new ArrayList<Long>();
		JSONArray idsArray =JSONArray.fromObject(ids);
		for (Object object : idsArray) {
			idList.add(Long.valueOf(object.toString()));
		}
		try {
			this.prjCstBscInfoService.removeByIds(idList);
			BaseLogUtils.info(logger, "removeById", "删除数据.[ids="+ids+"]", CurrentThreadContext.getCurrentUserName());
		}catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			BaseLogUtils.info(logger, "removeById", "删除数据失败.[ids="+ids+"]"+ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
			BaseLogUtils.error(logger, "removeById", "删除数据失败.[id="+ids+"]"+ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}

		return result;
	}
	
	/**
	 * 获取担保方式列表
	 * 
	 * @param request
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value = "/getGuarTypCdList.do", method = { RequestMethod.GET})
	@ResponseBody
	public Object getGuarTypCdList(HttpServletRequest request, HttpServletResponse response) throws BaseException {
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_OPERATE_SUCC);
		
		try {
			List<KeyValueVO> guarTcypCdList  = this.sysDictionaryApiService.getKvList(DictionaryConstant.CODE_PRJ_GUAR_TYP_CD, CurrentThreadContext.getCurrentSysCd(), CurrentThreadContext.getCurrentOrgCd());
			if(CollectionUtils.isEmpty(guarTcypCdList)){
				result.setSuccess(BaseConstant.IS_YESNO_NO);
				result.setInfo(SysLogConstant.LOG_CMM_QUERY_DATA_IS_EMPTY);
				BaseLogUtils.info(logger, "getGuarTypCdList", "获取数据,数据不存在", CurrentThreadContext.getCurrentUserName());
			}
			result.setData(guarTcypCdList);
			BaseLogUtils.info(logger, "getGuarTypCdList", "获取数据.[guarTcypCdList="+guarTcypCdList+"]", CurrentThreadContext.getCurrentUserName());
		}catch(BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			BaseLogUtils.info(logger, "getById", "获取失败"+ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}catch(Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
			BaseLogUtils.error(logger, "getById", "获取失败"+ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}
		return result;
	}

	/**
	 * 得到一条记录
	 * 
	 * @param request
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value = "/getById.do", method = { RequestMethod.GET})
	@ResponseBody
	public Object getById(HttpServletRequest request, HttpServletResponse response) throws BaseException {
		String id = request.getParameter("id");
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_OPERATE_SUCC);
		if(StringUtils.isEmpty(id)){
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_DATA_PK_IS_EMPTY);
			BaseLogUtils.error(logger, "getById", "获取数据,主键不存在.[id="+id+"]", CurrentThreadContext.getCurrentUserName());
			return result;
		}
		
		try {
			PrjCstBscInfoVO vo = this.prjCstBscInfoService.selectById(Long.valueOf(id));
			if(null == vo){
				result.setSuccess(BaseConstant.IS_YESNO_NO);
				result.setInfo(SysLogConstant.LOG_CMM_QUERY_DATA_IS_EMPTY);
				BaseLogUtils.info(logger, "getById", "获取数据,数据不存在.[id="+id+"]", CurrentThreadContext.getCurrentUserName());
			}
			result.setData(vo);
			BaseLogUtils.info(logger, "getById", "获取数据.[id="+id+"]", CurrentThreadContext.getCurrentUserName());
		}catch(BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			BaseLogUtils.info(logger, "getById", "获取失败.[id="+id+"]"+ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}catch(Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
			BaseLogUtils.error(logger, "getById", "获取失败.[id="+id+"]"+ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}
		return result;
	}

	
	/**
	 * 新增所选担保人信息
	 */
	@RequestMapping(value = "/addSelectPrjCstBscInfo.do", method = { RequestMethod.POST })
	@ResponseBody
	public Object addSelectPrjCstBscInfo(HttpServletRequest request, HttpServletResponse response) throws BaseException {
		String prjCstBscInfoList = request.getParameter("prjCstBscInfo");
		String cstRlTyp = request.getParameter("cstRlTyp");
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_ADD_SUCC);
		PrjCstBscInfoVO entity = null;
		String prjId = request.getParameter("prjId");//项目ID
		List<PrjCstBscInfoVO> list = new ArrayList<PrjCstBscInfoVO>();
		try {
			if (StringUtils.isNotBlank(prjCstBscInfoList)) {
				list = JSON.parseArray(prjCstBscInfoList, PrjCstBscInfoVO.class);
			}
			 this.prjCstBscInfoService.addPrjCstBscInfoList(list,Long.valueOf(prjId),cstRlTyp);
			BaseLogUtils.info(logger, "add", "新增数据.DATA:" + JSONObject.toJSONString(entity), CurrentThreadContext.getCurrentUserName());
		}catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			BaseLogUtils.info(logger, "add", "新增数据失败.DATA:" + JSONObject.toJSONString(entity) + ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
			BaseLogUtils.error(logger, "add", "新增数据失败.DATA:" + JSONObject.toJSONString(entity) + ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}

		return result;
	}
	/**
	 * 修改所选担保人信息
	 */
	@RequestMapping(value = "/modifySelectPrjCstBscInfo.do", method = { RequestMethod.POST })
	@ResponseBody
	public Object modifySelectPrjCstBscInfo(HttpServletRequest request, HttpServletResponse response) throws BaseException {
		String prjCstBscInfoList = request.getParameter("prjCstBscInfo");
		String cstRlTyp = request.getParameter("cstRlTyp");
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_ADD_SUCC);
		PrjCstBscInfoVO entity = null;
		String prjId = request.getParameter("prjId");//项目ID
		List<PrjCstBscInfoVO> list = new ArrayList<PrjCstBscInfoVO>();
		try {
			if (StringUtils.isNotBlank(prjCstBscInfoList)) {
				list = JSON.parseArray(prjCstBscInfoList, PrjCstBscInfoVO.class);
			}
			 this.prjCstBscInfoService.modifyPrjCstBscInfoList(list);
			 result.setInfo("修改成功！");
			BaseLogUtils.info(logger, "add", "修改数据.DATA:" + JSONObject.toJSONString(entity), CurrentThreadContext.getCurrentUserName());
		}catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			BaseLogUtils.info(logger, "add", "修改数据失败.DATA:" + JSONObject.toJSONString(entity) + ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
			BaseLogUtils.error(logger, "add", "修改数据失败.DATA:" + JSONObject.toJSONString(entity) + ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}

		return result;
	}
	
	/**
	 * 新增
	 */
	@RequestMapping(value = "/add.do", method = { RequestMethod.POST })
	@ResponseBody
	public Object add(HttpServletRequest request, HttpServletResponse response) throws BaseException {
		String prjId = request.getParameter("prjId");
		String cstId = request.getParameter("cstId");
		String cstRlCd =  request.getParameter("cstRlCd");
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_ADD_SUCC);
		PrjCstBscInfoVO entity = null;
		try {
			entity = new PrjCstBscInfoVO();
			if(StringUtils.isNotBlank(prjId)){
				entity.setPrjId(Long.valueOf(prjId));
			}
			if(StringUtils.isNotBlank(cstId)){
				entity.setCstId(Long.valueOf(cstId));
			}
			if(StringUtils.isNotBlank(cstRlCd)){
				entity.setCstRlCd(cstRlCd);
			}
			Long id = this.prjCstBscInfoService.add(entity);
			result.setData(id);
			BaseLogUtils.info(logger, "add", "新增数据.[id="+id+"] DATA:" + JSONObject.toJSONString(entity), CurrentThreadContext.getCurrentUserName());
		}catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			BaseLogUtils.info(logger, "add", "新增数据失败.DATA:" + JSONObject.toJSONString(entity) + ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
			BaseLogUtils.error(logger, "add", "新增数据失败.DATA:" + JSONObject.toJSONString(entity) + ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}

		return result;
	}

	/**
	 * 修改
	 */
	@RequestMapping(value = "/modify.do", method = { RequestMethod.POST })
	@ResponseBody
	public Object modify(HttpServletRequest request, HttpServletResponse response) throws BaseException {
		String id = request.getParameter("id");
		String rlCd = request.getParameter("rlCd");
		String visRec = request.getParameter("visRec");//访谈记录
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_UPDATE_SUCC);
		if(StringUtils.isEmpty(id)){
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_DATA_PK_IS_EMPTY);
			BaseLogUtils.info(logger, "modify", "修改数据,主键不存在.[id="+id+"]", CurrentThreadContext.getCurrentUserName());
			return result;
		}
		PrjCstBscInfoVO entity = null;
		try {
			entity = this.prjCstBscInfoService.selectById(Long.valueOf(id));
			if (StringUtils.isNotBlank(rlCd)) {
				entity.setRlCd(rlCd);
			}
			if(StringUtils.isNotBlank(visRec)){
				entity.setVisRec(visRec);
			}
			boolean success = this.prjCstBscInfoService.modify(entity);
			if(!success){
				result.setSuccess(BaseConstant.IS_YESNO_NO);
				result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
				BaseLogUtils.info(logger, "modify", "修改失败.[id="+id+"] DATA:" + JSONObject.toJSONString(entity), CurrentThreadContext.getCurrentUserName());
			}
			BaseLogUtils.info(logger, "modify", "修改成功.[id="+id+"] DATA:" + JSONObject.toJSONString(entity), CurrentThreadContext.getCurrentUserName());
		}catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			BaseLogUtils.info(logger, "modify", "修改失败.[id="+id+"] DATA:" + JSONObject.toJSONString(entity) + ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
			BaseLogUtils.error(logger, "modify", "修改失败.[id="+id+"] DATA:" + JSONObject.toJSONString(entity) + ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}
		return result;
	}

	/**
	 * 项目担保人列表页面
	 */
	@SuppressWarnings("unchecked")
	@RequestMapping(value = "/prjCstForDbr.do", method = { RequestMethod.GET})
	@ResponseBody
	public ModelAndView prjCstForDbr(HttpServletRequest request, HttpServletResponse response) {
		String prjId = request.getParameter("prjId");
		String purpCd = request.getParameter("purpCd");
		ModelAndView view = new ModelAndView("project/prjCstInfo/prjCstDbrList");
		view.addObject("prjId", prjId);
		view.addObject("purpCd", purpCd);
		BaseLogUtils.info(logger, "prjCstForDbr", "跳转到项目担保人列表页面.[prjId="+prjId+"]", CurrentThreadContext.getCurrentUserName());
		return view;
	}
	/**
	 * 推送担保合同
	 */
	@RequestMapping(value = "/pushCon.do", method = {RequestMethod.POST })
	@ResponseBody
	public DataResultVO pushCon(HttpServletRequest request, HttpServletResponse response) throws BaseException {
		String id = request.getParameter("id");
		String guaraTypCd = request.getParameter("guaraTypCd");
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_OPERATE_SUCC);
		if(StringUtils.isEmpty(id)){
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_DATA_PK_IS_EMPTY);
			return result;
		}
		if (StringUtils.isEmpty(guaraTypCd)){
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo("担保属性不能为空");
			return result;
		}
		try {
			BaseLogUtils.newLogger("查询担保人信息Begin:id="+id).info();
			PrjCstBscInfoVO prjCstBscInfoVO = this.prjCstBscInfoService.selectById(Long.valueOf(id));
			BaseLogUtils.newLogger("查询担保人信息End：prjId="+prjCstBscInfoVO.getPrjId()).info();
			Long prjId= prjCstBscInfoVO.getPrjId();
			Long cstId= prjCstBscInfoVO.getCstId();
			Long usrId = CurrentThreadContext.getCurrentUserId();
			BaseLogUtils.newLogger("推送担保合同Begin：pushCon--prjId=" + prjId + ",guaraTypCd=" + guaraTypCd + ",cstId=" + cstId + ",usrId=" + usrId).info();
			boolean conFlag = prjContApiService.addContDanBao(prjId.toString(), cstId.toString(), guaraTypCd, WebBaseConstant.SYS_SYS_CD, usrId.toString());
			BaseLogUtils.newLogger("推送担保合同End:conFlag=" + conFlag).info();
		}catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			BaseLogUtils.info(logger, "pushCon", "推送担保合同失败.[id="+id+"]"+ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
			BaseLogUtils.error(logger, "pushCon", "推送担保合同失败.[id="+id+"]"+ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}
		return result;
	}

	/**
	 * 初始化 项目客户担保人列表
	 * @param request
	 * @param response
	 * @return
	 */
	@SuppressWarnings("unchecked")
	@RequestMapping(value = "/initGuarantorList.do", method = { RequestMethod.GET})
	@ResponseBody
	public Object initGuarantorList(HttpServletRequest request, HttpServletResponse response) {
		String currentPage = request.getParameter("page");
		String pageSize = request.getParameter("pagesize");
		String cstRlTyp = request.getParameter("cstRlTyp");//客户属性
		String prjIdNow = request.getParameter("prjId");//项目Id
		List<PrjCstBscInfoVO> list = new ArrayList<PrjCstBscInfoVO>();
		String prjId =	prjBscInfoService.getPrjIdByPrjId(prjIdNow);
        Pager page = new Pager();
		if (StringUtils.isNotEmpty(currentPage)) {
			page.setCurrentPage(Integer.parseInt(currentPage));
		}
		if (StringUtils.isNotEmpty(currentPage)) {
			page.setEveryPage(Integer.parseInt(pageSize));
		}
		PrjCstBscInfoQueryCondition qc = new PrjCstBscInfoQueryCondition();
		if (StringUtils.isNotEmpty(cstRlTyp)) {
			qc.setCstRlTyp(cstRlTyp);
		}
		qc.setSysCd(CurrentThreadContext.getCurrentSysCd());
		qc.setOrgCd(CurrentThreadContext.getCurrentOrgCd());
		if(StringUtils.isNotBlank(prjId)){
			qc.setPrjId(Long.valueOf(prjId));
			page.setCondition(qc);
			BaseLogUtils.newLogger("initGuarantorList查询担保人信息begin--prjId" + prjId).info();
			Pager pager = this.prjCstBscInfoService.searchGuarListPage(page);
			if (CollectionUtils.isNotEmpty(pager.getResultList())){
				list.addAll((List<PrjCstBscInfoVO>) pager.getResultList());
			}
			BaseLogUtils.newLogger("initGuarantorList查询担保人信息End--size:" + list.size()).info();
		}
		if (!Objects.equals(prjId, prjIdNow)){//疫情贷会有两个项目id
			qc.setPrjId(Long.valueOf(prjIdNow));
			page.setCondition(qc);
			BaseLogUtils.newLogger("initGuarantorList查询疫情贷当前项目担保人信息begin--prjId" + prjId).info();
			Pager pager = this.prjCstBscInfoService.searchGuarListPage(page);
			BaseLogUtils.newLogger("initGuarantorList查询疫情贷当前项目担保人信息End--size:" + pager.getResultList().size()).info();
			if (CollectionUtils.isNotEmpty(pager.getResultList())){
				list.addAll((List<PrjCstBscInfoVO>) pager.getResultList());
			}
		}
		List<CstBscInfoVO> cstBscInfoVOList = new ArrayList<CstBscInfoVO>();
		if(CollectionUtils.isNotEmpty(list)){
			for (PrjCstBscInfoVO prjCstBscInfoVO : list) {
				CstBscInfoVO cstBscInfoVO = this.cstBscInfoService.selectDetailById(prjCstBscInfoVO.getCstId());
				cstBscInfoVO.setPrjCstBscInfoVO(prjCstBscInfoVO);
				cstBscInfoVOList.add(cstBscInfoVO);
			}
		}
		ListPageVO<CstBscInfoVO> listPage = new ListPageVO<CstBscInfoVO>(cstBscInfoVOList, list.size());
		BaseLogUtils.info(logger, "initGuarantorList", "查询数据完成. DATA:" + list.size(), CurrentThreadContext.getCurrentUserName());
		return listPage;
	}

	/**
	 * 删除担保人并作废合同
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping(value = "/removeCstAndDelCont.do", method = {RequestMethod.POST })
	@ResponseBody
	public DataResultVO removeCstAndDelCont(HttpServletRequest request, HttpServletResponse response) throws BaseException {
		String id = request.getParameter("id");
		String guaraTypCd = request.getParameter("guaraTypCd");//担保属性
		String prjId = request.getParameter("prjId");
		String isPushCon = request.getParameter("isPushCon");
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_DELETE_SUCC);
		if(StringUtils.isEmpty(id)){
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_DATA_PK_IS_EMPTY);
			return result;
		}
		try {
			BaseLogUtils.newLogger("removeCstAndDelCont开始删除担保人信息：prjid=" + prjId + ",id=" + id +",guaraTypCd=" + guaraTypCd + ",isPushCon=" + isPushCon).info();
			Boolean success = this.prjCstBscInfoService.removeCstAndDelCont(Long.valueOf(id), Long.valueOf(prjId), guaraTypCd, isPushCon);
			BaseLogUtils.newLogger("removeCstAndDelCont删除数据id="+id+"currUsr=" + CurrentThreadContext.getCurrentUserName()).info();
			if (!success){
				result.setSuccess(BaseConstant.IS_YESNO_NO);
				result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
				BaseLogUtils.info(logger, "removeById", "删除数据失败.[id="+id+"]", CurrentThreadContext.getCurrentUserName());
			}
		}catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			BaseLogUtils.info(logger, "removeById", "删除数据失败.[id="+id+"]"+ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
			BaseLogUtils.error(logger, "removeById", "删除数据失败.[id="+id+"]"+ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}
		return result;
	}

	/**
	 * 修改担保人信息，并判断作废合同
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping(value = "/modifyCstAndDelCont.do", method = {RequestMethod.POST })
	@ResponseBody
	public DataResultVO modifyCstAndDelCont(HttpServletRequest request, HttpServletResponse response) throws BaseException {
		String id = request.getParameter("id");
		String rlCd = request.getParameter("rlCd");
		String visRec = request.getParameter("visRec");//访谈记录
		String guaraTypCd = request.getParameter("guaraTypCd");//担保属性
		String cntTypCd = request.getParameter("cntTypCd");//担保合同签署方式
		String prjId = request.getParameter("prjId");
		String isPushCon = request.getParameter("isPushCon");
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_UPDATE_SUCC);
		if (StringUtils.isEmpty(id)) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_DATA_PK_IS_EMPTY);
			BaseLogUtils.info(logger, "modify", "修改数据,主键不存在.[id=" + id + "]", CurrentThreadContext.getCurrentUserName());
			return result;
		}
		PrjCstBscInfoVO entity = null;
		try {
			entity = new PrjCstBscInfoVO();
			entity.setId(Long.valueOf(id));
			if (StringUtils.isNotBlank(rlCd)) {
				entity.setRlCd(rlCd);
			}
			if (StringUtils.isNotBlank(visRec)) {
				entity.setVisRec(visRec);
			}
			if (StringUtils.isEmpty(guaraTypCd)){
				entity.setGuaraTypCd(PrjCstBscInfoConstant.GUARA_TYP_CD_RELATE);//默认连代担保
			}else {
				entity.setGuaraTypCd(guaraTypCd);
			}
			if (StringUtils.isEmpty(cntTypCd)){
				entity.setCntTypCd(PrjBscInfoConstant.CODE_PRJ_CNT_TYP_CD_ELC);//默认电子
			}else {
				entity.setCntTypCd(cntTypCd);
			}
			if (StringUtils.isNotEmpty(isPushCon)){
				entity.setIsPushCon(Integer.valueOf(isPushCon));
			}
			if (StringUtils.isNotEmpty(prjId)){
				entity.setPrjId(Long.valueOf(prjId));
			}
			BaseLogUtils.newLogger("开始修改担保人及已推送合同记录：prjId=" + prjId + "entity=" + JSON.toJSONString(entity)).info();
			boolean success = this.prjCstBscInfoService.modifyCstAndDelCont(entity);
			if (!success) {
				result.setSuccess(BaseConstant.IS_YESNO_NO);
				result.setInfo(SysLogConstant.LOG_CMM_UPDATE_FAIL);
				BaseLogUtils.info(logger, "modifyCstAndDelCont", "修改失败.[id=" + id + "] DATA:" + JSONObject.toJSONString(entity), CurrentThreadContext.getCurrentUserName());
			}
			BaseLogUtils.info(logger, "modifyCstAndDelCont", "修改成功.[id=" + id + "] DATA:" + JSONObject.toJSONString(entity), CurrentThreadContext.getCurrentUserName());
		} catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			BaseLogUtils.info(logger, "modifyCstAndDelCont", "修改失败.[id=" + id + "] DATA:" + JSONObject.toJSONString(entity) + ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		} catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_UPDATE_FAIL);
			BaseLogUtils.error(logger, "modifyCstAndDelCont", "修改失败.[id=" + id + "] DATA:" + JSONObject.toJSONString(entity) + ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}
		return result;
	}

}

